package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.ShopOrder;
import cn.wolfcode.trip.base.mapper.ShopOrderMapper;
import cn.wolfcode.trip.base.service.IShopOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Copyright: Copyright (c) 2019 Super520
 * 描述：
 *
 * @package: cn.wolfcode.trip.base.service.impl
 * @author: Patch
 * @date: 2019/6/2 21:10
 * 总结:
 */
@Service
public class ShopOrderServiceImpl implements IShopOrderService {
    @Autowired
    private ShopOrderMapper orderMapper;
    @Override
    public void saveOrUpdate(ShopOrder shopOrder) {
        if (shopOrder.getId() != null) {
            orderMapper.updateByPrimaryKey(shopOrder);
        }else{
            orderMapper.insert(shopOrder);
        }
    }

    @Override
    public List<ShopOrder> listAll() {
        return orderMapper.selectAll();
    }

    @Override
    public ShopOrder get(Long id) {
        return orderMapper.selectByPrimaryKey(id);
    }

    @Override
    public Object listAllByUid(Long uId) {
        return orderMapper.listAllByUid(uId);
    }
}
